#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

//typedef unsigned long LONG;
typedef long double LONG;


/* main
 *  * */
int main() {
	std::ios_base::sync_with_stdio (true);
	LONG N;
	const LONG log2=log10(2);
	cin >> N;
	do {
		LONG I = floor(log10(N));
		I = I+2;
		while(true) {
			LONG A = ceil((log10(N)+I)/log2);
			LONG B = floor((log10(N+1)+I)/log2);
			if (A == B){
				cout << std::setprecision(0) << std::noshowpoint << std::fixed << A << endl;
				break;
			}
			++I;
		}   
		cin >> N;

	} while(cin.eof() == false);
	return 0;
}
